<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Zend_Reflection Examples - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.reflection.examples.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.reflection.examples.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.reflection.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.reflection.html">Zend_Reflection</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.reflection.reference.html">Zend_Reflection Reference</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.reflection.examples" class="section"><div class="info"><h1 class="title">Zend_Reflection Examples</h1></div>
    

    <div class="example" id="zend.reflection.examples.file"><div class="info"><p><b>Example #1 Performing reflection on a file</b></p></div>
        

        <pre class="programlisting brush: php">
$r = new Zend_Reflection_File($filename);
printf(
    &quot;===&gt; The %s file\n&quot;.
    &quot;     has %d lines\n&quot;,
    $r-&gt;getFileName(),
    $r-&gt;getEndLine()
);

$classes = $r-&gt;getClasses();
echo &quot;     It has &quot; . count($classes) . &quot;:\n&quot;;
foreach ($classes as $class) {
    echo &quot;         &quot; . $class-&gt;getName() . &quot;\n&quot;;
}

$functions = $r-&gt;getFunctions();
echo &quot;     It has &quot; . count($functions) . &quot;:\n&quot;;
foreach ($functions as $function) {
    echo &quot;         &quot; . $function-&gt;getName() . &quot;\n&quot;;
}
</pre>

    </div>

    <div class="example" id="zend.reflection.examples.class"><div class="info"><p><b>Example #2 Performing reflection on a class</b></p></div>
        

        <pre class="programlisting brush: php">
$r = new Zend_Reflection_Class($class);

printf(
    &quot;The class level docblock has the short description: %s\n&quot;.
    &quot;The class level docblock has the long description:\n%s\n&quot;,
    $r-&gt;getDocblock()-&gt;getShortDescription(),
    $r-&gt;getDocblock()-&gt;getLongDescription(),
);

// Get the declaring file reflection
$file = $r-&gt;getDeclaringFile();
</pre>

    </div>

    <div class="example" id="zend.reflection.examples.method"><div class="info"><p><b>Example #3 Performing reflection on a method</b></p></div>
        

        <pre class="programlisting brush: php">
$r = new Zend_Reflection_Method($class, $name);

printf( &quot;Method &#039;%s&#039;:\n&quot;, $r-&gt;getName());

foreach ($r-&gt;getParameters() as $key =&gt; $param) {
    printf(
        &quot;Param at position &#039;%d&#039; is of type &#039;%s&#039;\n&quot;,
        $key,
        $param-&gt;getType()
    );
}
</pre>

    </div>

    <div class="example" id="zend.reflection.examples.docblock"><div class="info"><p><b>Example #4 Performing reflection on a docblock</b></p></div>
        

        <pre class="programlisting brush: php">
$r = new Zend_Reflection_Method($class, $name);
$docblock = $r-&gt;getDocblock();

printf(
    &quot;The short description: %s\n&quot;.
    &quot;The long description:\n%s\n&quot;,
    $r-&gt;getDocblock()-&gt;getShortDescription(),
    $r-&gt;getDocblock()-&gt;getLongDescription(),
);

foreach ($docblock-&gt;getTags() as $tag) {
    printf(
        &quot;Annotation tag &#039;%s&#039; has the description &#039;%s&#039;\n&quot;,
        $tag-&gt;getName(),
        $tag-&gt;getDescription()
    );
}
</pre>

    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.reflection.introduction.html">Introduction</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.reflection.html">Zend_Reflection</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.reflection.reference.html">Zend_Reflection Reference</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.reflection.html">Zend_Reflection</a></li>
  <li><a href="zend.reflection.introduction.html">Introduction</a></li>
  <li class="active"><a href="zend.reflection.examples.html">Zend_Reflection Examples</a></li>
  <li><a href="zend.reflection.reference.html">Zend_Reflection Reference</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>